﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Wechat.Entity.Migrations
{
    /// <inheritdoc />
    public partial class initcreate : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Article",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "TEXT", nullable: false),
                    Biz = table.Column<string>(type: "TEXT", nullable: true),
                    Mid = table.Column<long>(type: "INTEGER", nullable: true),
                    Idx = table.Column<int>(type: "INTEGER", nullable: true),
                    IsDownload = table.Column<bool>(type: "INTEGER", nullable: false),
                    IsXunFei = table.Column<bool>(type: "INTEGER", nullable: false),
                    Url = table.Column<string>(type: "TEXT", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Article", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CollectionArticle",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "TEXT", nullable: false),
                    Biz = table.Column<string>(type: "TEXT", nullable: true),
                    Mid = table.Column<long>(type: "INTEGER", nullable: true),
                    Idx = table.Column<int>(type: "INTEGER", nullable: true),
                    IsDownload = table.Column<bool>(type: "INTEGER", nullable: false),
                    IsXunFei = table.Column<bool>(type: "INTEGER", nullable: false),
                    Url = table.Column<string>(type: "TEXT", nullable: true),
                    CollectionUrl = table.Column<string>(type: "TEXT", nullable: true),
                    Title = table.Column<string>(type: "TEXT", nullable: true),
                    FolderName = table.Column<string>(type: "TEXT", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CollectionArticle", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TopicArticle",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "TEXT", nullable: false),
                    Biz = table.Column<string>(type: "TEXT", nullable: true),
                    Mid = table.Column<long>(type: "INTEGER", nullable: true),
                    IsDownload = table.Column<bool>(type: "INTEGER", nullable: false),
                    IsXunFei = table.Column<bool>(type: "INTEGER", nullable: false),
                    Url = table.Column<string>(type: "TEXT", nullable: true),
                    Title = table.Column<string>(type: "TEXT", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TopicArticle", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Wechat",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "TEXT", nullable: false),
                    Biz = table.Column<string>(type: "TEXT", nullable: true),
                    Name = table.Column<string>(type: "TEXT", nullable: true),
                    StartDate = table.Column<DateTime>(type: "TEXT", nullable: true),
                    EndDate = table.Column<DateTime>(type: "TEXT", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Wechat", x => x.Id);
                });

            migrationBuilder.CreateIndex(
                name: "IX_Article_Url",
                table: "Article",
                column: "Url",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_CollectionArticle_Url",
                table: "CollectionArticle",
                column: "Url",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_TopicArticle_Url",
                table: "TopicArticle",
                column: "Url",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Wechat_Biz",
                table: "Wechat",
                column: "Biz",
                unique: true);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Article");

            migrationBuilder.DropTable(
                name: "CollectionArticle");

            migrationBuilder.DropTable(
                name: "TopicArticle");

            migrationBuilder.DropTable(
                name: "Wechat");
        }
    }
}
